package com.hsgene.order.constants.v1;

/**
 * 支付渠道枚举
 *
 * @author wangbing
 * @version 1.0, 2018/10/26
 */
public enum PaymentChannelType {

    /**
     * 支付渠道枚举
     */
    ALI_PAY(1, "支付宝"), WX_PAY(2, "微信"), UNION_PAY(3, "银联"), UNDERLINE_PAY(4,"线下收款"), UNDEFINED(99, "未知支付渠道");

    private final int code;

    private final String desc;

    PaymentChannelType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PaymentChannelType getEnum(int code) {
        for (PaymentChannelType type : values()) {
            if (type.code == code) {
                return type;
            }
        }

        return UNDEFINED;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
